package com.fcx.workai.loginmodule.ui.setpwd;/**
 * Created by hxh on 2017/8/4.
 */


import com.hxh.component.basicore.component.mvp.persenter.BasePresenter;
import com.hxh.component.basicore.util.rx.resetfulhttpstyle.ProgressSubScribe;
import com.hxh.component.business.app.App;

import com.fcx.workai.loginmodule.api.ApiFactory;
import com.fcx.workai.loginmodule.api.request.Request_Setpwd;
import com.fcx.workai.loginmodule.bean.UserSetPwdResultBean;

/**
 * 创建者：hxh
 * 时间：  2017/8/4
 * 描述：
 */
public class SetPwdPresenter extends BasePresenter<SetPwdFragment> implements SetPwdContract.P {


    @Override
    public void setPwd(String realpwd) {
        addSubscription(
                ApiFactory
                        .setpwd(App.getUserDTO().getUser().getUser().getId(),new Request_Setpwd(realpwd))
                        .subscribe(new ProgressSubScribe<UserSetPwdResultBean>() {
                            @Override
                            public void _OnError(Throwable msg) {

                            }

                            @Override
                            public void _OnNet(UserSetPwdResultBean userInfoBean) {
                                getView().showLoginResule(userInfoBean);
                            }
                        })
        );
    }
}
